//
//  UIButton+Ext.swift
//  微博
//
//  Created by admin on 2018/3/20.
//  Copyright © 2018年 xm. All rights reserved.
//

import Foundation

extension UIButton{

    convenience init(title: String?, fontSize: CGFloat=normalFontSize, normalColor: UIColor, hightlightedColor: UIColor, backgroundImgname: String, target: Any?, action: Selector?) {
        self.init()
        setTitle(title, for: .normal)
        setTitleColor(normalColor, for: .normal)
        setTitleColor(hightlightedColor, for: .highlighted)
        self.titleLabel?.font=UIFont.systemFont(ofSize: fontSize)
        setBackgroundImage(UIImage(named:backgroundImgname), for: .normal)
        if target != nil && action != nil {
            addTarget(target, action: action!, for: .touchUpInside)
        }
    }

}
